﻿using WeDonekRpc.Model;

namespace RpcCentral.Collect.Model
{
    /// <summary>
    /// 服务负载
    /// </summary>
    public class Transmit : ServerTransmit, IEquatable<Transmit>
    {

        /// <summary>
        /// 服务节点Id
        /// </summary>
        public long ServerId
        {
            get;
            set;
        }
        /// <summary>
        /// 排序
        /// </summary>
        public int Sort
        {
            get;
            set;
        }
        public override bool Equals (object obj)
        {
            if (obj is Transmit i)
            {
                return i.Scheme == this.Scheme && i.ServerId == this.ServerId;
            }
            return false;
        }

        public bool Equals (Transmit other)
        {
            if (other == null)
            {
                return false;
            }
            return other.Scheme == this.Scheme && other.ServerId == this.ServerId;
        }

        public override int GetHashCode ()
        {
            return string.Concat(this.Scheme, "_", this.ServerId).GetHashCode();
        }
    }
}
